package com.yztc.administrator.meishi.adapter;

/*
 * @author: ZTC
 * @Description:  vp适配器
 * @创建时间:  2016/9/19 18:33 
 */

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.yztc.administrator.meishi.construct.Path;
import com.yztc.administrator.meishi.fragment.HotFragment;

import java.util.List;
import java.util.Map;

public class ViewPagerAdapter extends FragmentPagerAdapter{

    private static String[] titles = {"热门","搞笑","美妆","美食","吃秀","音乐","舞蹈","宝宝","明星动态","女傻逼","涨姿势","宠物","傻逼","逛拍"};
    private Bundle bundle;
    private static List<Map<String,Object>> mList;

    public ViewPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    private static final int FRAGMENT_HOT = 0;
    private static final int FRAGMENT_GAOXIAO = 1;
    private static final int FRAGMENT_MEIZHUANG = 2;
    private static final int FRAGMENT_FOOD = 3;
    private static final int FRAGMENT_CHIXIU = 4;
    private static final int FRAGMENT_MUSIC = 5;
    private static final int FRAGMENT_DANCE = 6;
    private static final int FRAGMENT_BABY = 7;
    private static final int FRAGMENT_MINGXING = 8;
    private static final int FRAGMENT_NVSB = 9;
    private static final int FRAGMENT_ZHANGZISHI = 10;
    private static final int FRAGMENT_PET = 11;
    private static final int FRAGMENT_SB = 12;
    private static final int FRAGMENT_GUANGPAI = 13;


    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        //根据位置获取对应fragment
        switch (position) {
            case FRAGMENT_HOT:
                fragment = new HotFragment();
                bundle =  new Bundle();
                bundle.putString("path", Path.HOT);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_GAOXIAO:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.Happy);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_MEIZHUANG:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.SH);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_FOOD:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path",Path.EAT );
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_CHIXIU:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.EAT_SHOW);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_MUSIC:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.MUSIC);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_DANCE:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path",Path. DANCE);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_BABY:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path",Path. BABY);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_MINGXING:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.STAR);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_NVSB:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.WOMEN);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_ZHANGZISHI:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.ZY);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_PET:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.PAT);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_SB:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.MAN);
                fragment.setArguments(bundle);
                break;
            case FRAGMENT_GUANGPAI:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("path", Path.Gpai);
                fragment.setArguments(bundle);
                break;
        }

        return fragment;
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }


}
